#include <iostream>
#include <cstring>
using namespace std;

int main(){
	
	int last[26] = {-1};
	int n;
	int pre[10000] = {0};
	long long ans = 0;
	string s;
	cin>>s;
	int len = s.size();
	
	for(int i = 0;i < len;i++){
		for(int j = i;j < len;j++){
			last[j] = s[j]-'a';
			int k = j; 
			int m = 0;
			while(m<26){
				pre[m++]=0;
			}
			while(k>=i){
				pre[last[k]]++;
				k--;
			}
			for(int n = 0;n < 26;n++){
				if(pre[n]!=0){
					ans++;
				}
			}
			
		}
	}
	cout<<ans<<endl;
	system("pause");
	return 0;
}
